package com.ljh.controller;


import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.ljh.pojo.Dinding;
import com.ljh.service.FLOORService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 刘剑鸿
 * @since 2021-09-30
 */
@Controller
@RequestMapping("/floors")
public class FloorsController {

    @Autowired
    private FLOORService floorService;

    @RequestMapping("/gettableId")
    @ResponseBody
    public String gettable(int id) throws JsonProcessingException {
        List<Dinding> floors = floorService.ding(id);
        ObjectMapper mapper = new ObjectMapper();
        String str = mapper.writeValueAsString(floors);
       // System.out.println("下拉框"+ str);
        return str;
    }

    @RequestMapping("/getOuttableId")
    @ResponseBody
    public String getOuttableId(int id) throws JsonProcessingException {
        List<Dinding> foor = floorService.Outding(id);
        ObjectMapper mapper = new ObjectMapper();
        String str = mapper.writeValueAsString(foor);
         //System.out.println("下拉框"+ str);
        return str;
    }
}

